package com.StarStudio.DAO;


import com.ruoyi.common.core.Entity.PanicBuyingOrders;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PanicBuyingOrdersDAO {

    List<PanicBuyingOrders> findPanicBuyingOrdersList(PanicBuyingOrders panicBuyingOrders);

    @Select("select count(panic_buying_order_id) from panic_buying_orders")
    long findTotalRecord();

    @Insert("insert into panic_buying_orders values (null,#{user_id},#{order_id},#{goods_id},#{coupons_id},#{del_flag})")
    @Options(useGeneratedKeys = true,keyProperty = "panic_buying_order_id",keyColumn = "panic_buying_order_id")
    void addPB_order(PanicBuyingOrders panicBuyingOrders);


    @Select("select * from panic_buying_orders where goods_id = #{thingsId} and user_id = #{user_id}")
    PanicBuyingOrders findPanicBuyingGoodsOrder(@Param("user_id") long user_id, @Param("thingsId") long thingsId);

    @Select("select * from panic_buying_orders where coupons_id = #{thingsId} and user_id = #{user_id}")
    PanicBuyingOrders findPanicBuyingCouponsOrder(@Param("user_id")long user_id, @Param("thingsId") long thingsId);
}
